package com.hxl.alert.controller;

import com.hxl.alert.mq.MessageProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Autowired
    private MessageProducer messageProducer;

    @GetMapping("/send")
    public String sendMessage(@RequestParam("id") String id, @RequestParam("faultDescr") String faultDescr) {
        messageProducer.send("ALERT_TOPIC", id, faultDescr);
        return "消息已发送";
    }
}